/**
 *@File ExeInfoTestMain.h
 *
 *@Author: Bob
 *
 *@Create Time: 2017-4-17 16:53:53
 *
 *@Last Modify: Bob
 *
 *@Last Modify Time: 2017-4-17 16:53:53
 *
 *@Description:
 *   
 *
 */


#include <iostream>
#include "../QueryExeInfo/QueryExeInfo.h"
#include "../QueryExeInfo/SignVerify.h"
#include "../QueryExeInfo/Md5Sum.h"


void ShowExeInfo(char* pExeAbsolutePath)
{
	if (pExeAbsolutePath != NULL)
	{
		QueryExeInfo queryExeInfo;
		std::string strInfo;

		if (queryExeInfo.QueryExeFileDescription(pExeAbsolutePath, strInfo))
		{
			std::cout << "FileDescription:" << strInfo << std::endl;
		}

		if (queryExeInfo.QueryExeFileVersion(pExeAbsolutePath, strInfo))
		{
			std::cout << "FileVersion:" << strInfo << std::endl;
		}

		if (queryExeInfo.QueryExeProductName(pExeAbsolutePath, strInfo))
		{
			std::cout << "ProductName:" << strInfo << std::endl;
		}

		if (queryExeInfo.QueryExeProductVersion(pExeAbsolutePath, strInfo))
		{
			std::cout << "ProductVersion:" << strInfo << std::endl;
		}

		if (queryExeInfo.QueryExeLegalCopyright(pExeAbsolutePath, strInfo))
		{
			std::cout << "LegalCopyright:" << strInfo << std::endl;
		}

		if (queryExeInfo.QueryExeOriginalFilename(pExeAbsolutePath, strInfo))
		{
			std::cout << "OriginalFilename:" << strInfo << std::endl;
		}
		else
		{
			std::cout << "ExeAbsolutePath:" << pExeAbsolutePath << std::endl;
		}

		if (SignVerify::GetCertificateInfo(pExeAbsolutePath, strInfo))
		{
			std::cout << "Sign Subject Name:" << strInfo << std::endl;
		}

		std::string strFilePath = pExeAbsolutePath;
		std::string strMD5;
		if (GetMd5Sum(strFilePath, strMD5))
		{
			std::cout << "MD5:" << strMD5 << std::endl;
		}

		std::cout << "====================================" << std::endl;
	}
}



int main(int argc, char* argv[])
{
	char* pExeAbsolutePath = "D:\\ProgramFiles(x86)\\Firefox\\firefox.exe";
	ShowExeInfo(pExeAbsolutePath);

	pExeAbsolutePath = "D:\\ProgramFiles(x86)\\QQ\\Bin\\QQ.exe";
	ShowExeInfo(pExeAbsolutePath);

	pExeAbsolutePath = "D:\\ProgramFiles(x86)\\BaiduYun\\BaiduNetdisk\\BaiduNetdisk.exe";
	ShowExeInfo(pExeAbsolutePath);
	return 0;
}